package com.wkq.move.module.tv.ui.adapter

import android.content.Context
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.wkq.lib_base.adapter.KtDataBindingAdapter
import com.wkq.lib_base.adapter.KtDataBindingViewHolder
import com.wkq.move.databinding.ItemSiteInfoBinding
import com.wkq.move.databinding.ItemTvSiteBinding
import com.wkq.net.model.UsTvDetailInfo

/**
 *
 * 作者:吴奎庆
 *
 * 时间:2020/5/20
 *
 * 用途:
 */


class SiteInfoAdapter(context: Context, layoutId: Int) :
    KtDataBindingAdapter<UsTvDetailInfo.PlayOnLineInfo>(context, layoutId) {

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        var ktDataBindingViewHolder = holder as KtDataBindingViewHolder
        var itemTvSiteBinding = ktDataBindingViewHolder.getBinding() as ItemSiteInfoBinding
        itemTvSiteBinding.data = getItem(position)

        if (viewClickListener != null) {
            itemTvSiteBinding.root.setOnClickListener(object : View.OnClickListener {
                override fun onClick(v: View?) {
                    viewClickListener!!.onViewClick(itemTvSiteBinding.root, getItem(position))
                }
            })
        }
    }

}

